import request from '@/utils/request'
import { qualityApiUrl } from '@/api/config.js'

// 质量风险上报 //
/**
 * 查询风险上报列表-所有的项目所有的风险上报列表
 * @param data
 */
export function getList(data) {
  return request({
    url: qualityApiUrl + '/quality/riskEscalation/queryDetails',
    method: 'post',
    data: data
  })
}
/**
 * 查询单个风险上报
 * @param id
 */ 
export function getDetail(id, bussinessId) {
  if (bussinessId) {
    return request({
      url: qualityApiUrl + `/quality/riskEscalation/${id}/${bussinessId}`,
      method: 'get',
    })
  } else {
    return request({
      url: qualityApiUrl + `/quality/riskEscalation/${id}`,
      method: 'get',
    })
  }
  
}
/**
 * 删除
 * @param id
 */ 
export function handleDelete(id) {
  return request({
    url: qualityApiUrl + `/quality/riskEscalation/remove/${id}`,
    method: 'get',
  })
}
/**
 * 修改项目风险上报
 * @param data
 */
export function updatePost(data) {
  return request({
    url: qualityApiUrl + '/quality/riskEscalation/update',
    method: 'post',
    data: data
  })
}
/**
 * 新增项目风险上报
 * @param data
 */
export function handleCreate(data) {
  return request({
    url: qualityApiUrl + '/quality/riskEscalation/create',
    method: 'post',
    data: data
  })
}
/**
 * 统计总数
 * @param data
 */
export function count(data) {
  return request({
    url: qualityApiUrl + '/quality/riskEscalation/statistics',
    method: 'post',
    data: data
  })
}
/**
 * 导出接口
 * @param data
 */
export function batchPrint(id) {
  return request({
    url: qualityApiUrl + `/quality/riskEscalation/excels/${id}`,
    method: 'get',
  })
}
/**
 * 确认处理接口
 * @param data
 */
export function audit(data) {
  return request({
    url: qualityApiUrl + `/quality/riskEscalation/audit`,
    method: 'post',
    data: data
  })
}

export const riskReporting = {
  batchPrint,
  getList,
  count,
  getDetail,
  handleCreate,
  updatePost,
  handleDelete,
  audit,
}


